using System;

namespace PropertyExpression.ControllableQuery.Test.Queries.StringBuilding
{
    public class PublicationInsertQuery : INonQuery
    {
        private readonly IParam<Guid> publicationTypeId;
        private readonly IParam<int> code;

        public PublicationInsertQuery(
            IParam<Guid> publicationTypeId,
            IParam<int> code)
        {
            this.publicationTypeId = publicationTypeId;
            this.code = code;
        }

        public string TransformText()
        {
            publicationTypeId.ToSql("@PublicationTypeId");
            code.ToSql("@Code");
            return
@"INSERT INTO
    PublicationType
    (
     PublicationTypeId,
     Code 
    )
VALUES
    (@PublicationTypeId,
     @Code
     )";
        }
    }

    public class PublicationDeleteQuery : INonQuery
    {
        private readonly IParam<Guid> publicationTypeId;

        public PublicationDeleteQuery(IParam<Guid> publicationTypeId)
        {
            this.publicationTypeId = publicationTypeId;
        }

        public string TransformText()
        {
            publicationTypeId.ToSql("@PublicationTypeId");
            return @"DELETE FROM PublicationType WHERE PublicationTypeId = @PublicationTypeId";
        }
    }
}